package com.mapper;

import com.entity.TTag;
import com.entity.TTagExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface TTagMapper {
    @SelectProvider(type=TTagSqlProvider.class, method="countByExample")
    int countByExample(TTagExample example);

    @DeleteProvider(type=TTagSqlProvider.class, method="deleteByExample")
    int deleteByExample(TTagExample example);

    @Delete({
        "delete from t_tag",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into t_tag (aid, title, ",
        "tag, update_time)",
        "values (#{aid,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, ",
        "#{tag,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(TTag record);

    @InsertProvider(type=TTagSqlProvider.class, method="insertSelective")
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insertSelective(TTag record);

    @SelectProvider(type=TTagSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="aid", property="aid", jdbcType=JdbcType.INTEGER),
        @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
        @Result(column="tag", property="tag", jdbcType=JdbcType.VARCHAR),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<TTag> selectByExample(TTagExample example);

    @Select({
        "select",
        "id, aid, title, tag, update_time",
        "from t_tag",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="aid", property="aid", jdbcType=JdbcType.INTEGER),
        @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
        @Result(column="tag", property="tag", jdbcType=JdbcType.VARCHAR),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP)
    })
    TTag selectByPrimaryKey(Integer id);

    @UpdateProvider(type=TTagSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") TTag record, @Param("example") TTagExample example);

    @UpdateProvider(type=TTagSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") TTag record, @Param("example") TTagExample example);

    @UpdateProvider(type=TTagSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(TTag record);

    @Update({
        "update t_tag",
        "set aid = #{aid,jdbcType=INTEGER},",
          "title = #{title,jdbcType=VARCHAR},",
          "tag = #{tag,jdbcType=VARCHAR},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(TTag record);
}